package com.diandian.backend.log.param;

import com.diandian.backend.log.dto.LogTaskDeleteReadyParamDTO;
import com.diandian.base.boot.starter.exception.DefaultException;
import java.io.Serializable;

public class LogTaskDeleteReadyParam implements Serializable {

	private Long id;
	private String belong;
	private String businessType;
	private String businessId;
	private String taskId;

	public void check(){
		if(this.belong == null || "".equals(this.belong)){
			throw new DefaultException("归属标识不能为空");
		}

		boolean isBusinessTypeNullFlag = this.businessType == null || "".equals(this.businessType);
		boolean isBusinessIdNullFlag = this.businessId == null || "".equals(this.businessId);
		boolean isTaskIdNullFlag = this.taskId == null || "".equals(this.taskId);
		boolean isIdNullFlag = this.id == null;

		if(isIdNullFlag && isBusinessTypeNullFlag && isBusinessIdNullFlag && isTaskIdNullFlag){
			throw new DefaultException("参数不完整");
		}

		if(!isBusinessIdNullFlag && isBusinessTypeNullFlag){
			throw new DefaultException("业务id不为空时，业务类型不能为空");
		}
		if(isBusinessIdNullFlag && !isBusinessTypeNullFlag){
			throw new DefaultException("业务类型不为空时，业务id不能为空");
		}
	}

	public LogTaskDeleteReadyParamDTO toDTO(){
		LogTaskDeleteReadyParamDTO dto = new LogTaskDeleteReadyParamDTO();
		dto.setId(this.id);
		dto.setBelong(this.belong);
		dto.setBusinessType(this.businessType);
		dto.setBusinessId(this.businessId);
		dto.setTaskId(this.taskId);
		return dto;
	}

	public Long getId() {
		return id;
	}
	public Long setId(Long id) {
		return this.id = id;
	}
	public String getBelong() {
		return belong;
	}
	public String setBelong(String belong) {
		return this.belong = belong;
	}
	public String getBusinessType() {
		return businessType;
	}
	public String setBusinessType(String businessType) {
		return this.businessType = businessType;
	}
	public String getBusinessId() {
		return businessId;
	}
	public String setBusinessId(String businessId) {
		return this.businessId = businessId;
	}

	public String getTaskId() {
		return taskId;
	}

	public void setTaskId(String taskId) {
		this.taskId = taskId;
	}
}
